<template>

<div class="top">

    <van-nav-bar title="我的"  class="my"/>


    <van-nav-bar  left-text="返回" left-arrow @click-left="onClickLeft"  @click-right="onClickRight">
        <template #right>
            <van-icon name="setting-o" size="18"/>
        </template>
    </van-nav-bar>


    <van-row class="first">
      <van-col span="6" class="img">
      <van-image
        height="60px"
        width="60px"
        fit="fill"
        :src="user.headImage"/>
      </van-col>

        <van-col>
           <van-row>
              <van-col span="8" class="username">{{ user.username }}</van-col>
           </van-row>
            <van-row>关注 13 | 评价 30 | 勋章 33</van-row>
        </van-col>
    </van-row>

</div>

</template>

<script>
import {Col, Row, showDialog} from 'vant';
export default {
    name: "my",
    data(){
        return{
            user:'',
            order:''
        }
    },
    methods:{
       _initMy(){
           this.$axios.get('/ele_server/user/my').then(({data:res})=>{
               if(res.status==0){
                   this.user=res.data
                   console.log(this.user)
               }else if(res.status==3003) {
                   showDialog({
                       title: '提示',
                       message: '当前未登录',
                       theme: 'round-button',
                       confirmButtonText: '去登录'
                   }).then(() => {
                       this.$router.push('/user/login?redirect=/user/my');
                   });
               }

           })
       },
        onClickLeft(){
           this.$router.back()
        },
        onClickRight(){
            this.$router.push('/address/addressAdd')
        },
    },
    created() {
        this._initMy()
    }
}
</script>

<style scoped lang="stylus">
.top
    .first
        height 60px
        .img
            height 100%
            width 40px
            margin-left 15px
        .username
            font-size 18px
            font-weight bold
        .service
            font-size 17px
        .set
          font-size 30px
          margin-left 20px
    .img-order
        margin-top 10px
        display flex
        justify-content center
        align-items center
      .item
        margin-left 15px
    .my
      font 20px
</style>
